<% layout('/layouts/default.html', {title: '理论考试表管理', libs: ['validate','fileupload']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header with-border">
			<div class="box-title">
				<i class="fa icon-note"></i> ${text(texaminationBarbecue.isNewRecord ? '新增问题' : '编辑问题')}
			</div>
			<div class="box-tools pull-right">
				<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
			</div>
		</div>
		<#form:form id="inputForm" model="${texaminationBarbecue}" action="${ctx}/zx/examination/barbecue/texaminationBarbecue/save2" method="post" class="form-horizontal">
			<div class="box-body">
				<div class="form-unit">${text('基本信息')}</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4">${text('标题')}：</label>
							<div class="col-sm-8">
								<#form:treeselect id="parent" title="${text('标题')}"
									path="parent.id" labelPath="parent.objName"
									url="${ctx}/zx/examination/barbecue/texaminationBarbecue/treeData?excludeCode=${texaminationBarbecue.id}"
									class="" allowClear="true" canSelectRoot="true" readonly="true" canSelectParent="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('考试类别')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
							<#form:select path="category" readonly="true" dictType="t_examination_category" blankOption="true" class="form-control" />
							</div>
						</div>
					</div>
					<div class="col-xs-6 hide">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('岗位')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="post" readonly="true" maxlength="100" class="form-control"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row hide">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('考试内容名称')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="examId" maxlength="100" class="form-control digits"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6 hide">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('主键')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:hidden path="isNewRecord"/>
							<#form:input path="id" maxlength="50" readonly="${!texaminationBarbecue.isNewRecord}" class="form-control required abc"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required">*</span> ${text('题目名称')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="objName" maxlength="255" class="form-control required"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required">*</span> ${text('题目类型')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
							<#form:select path="objType" maxlength="10" onChange="selectVal(this)" dictType="t_exercises_query" blankOption="true" class="form-control digits" />
							</div>
						</div>
					</div>
				</div>
				
				<div class="row hide">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('报名开始时间')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="barbecueStartDate" readonly="true" maxlength="20" class="form-control Wdate"
									dataFormat="datetime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',isShowClear:true});"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('报名结束日期')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="barbecueEndDate" readonly="true" maxlength="20" class="form-control Wdate"
									dataFormat="datetime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',isShowClear:true});"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('当前层级排序号')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="treeSort" class="form-control digits"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('本题总分')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="maxScore" maxlength="255" class="form-control"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row hide" id="courseContent3">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								<span class="required hide">*</span> ${text('阅读文章')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-10">
								<#form:textarea path="objSimple" rows="4" maxlength="1555" class="form-control"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row hide" id="courseContent4">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								<span class="required hide">*</span> ${text('问题附件')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-10">
							<#form:fileupload path="fileUrl" 
								id="fileUrl" 
								returnPath="true"
								filePathInputId="fileUrl"
								maxUploadNum="1"
                                imageMaxWidth='-1'
								imageMaxHeight='-1'
								uploadType="all"  preview="weboffice" class="" readonly="false"/>
								<#form:input path="fileUrl" class="form-control hide"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row hide">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								<span class="required hide">*</span> ${text('备注')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-10">
								<#form:textarea path="remarks" rows="4" maxlength="1555" class="form-control"/>
							</div>
						</div>
					</div>
				</div>
				<#form:input path="objExplain" maxlength="10" value="2" class="form-control digits hide"/>
				
				
				
				
			</div>
			<div class="box-footer">
				<div class="row">
					<div class="col-sm-offset-2 col-sm-10">
						<% if (hasPermi('zx:examination:barbecue:texaminationBarbecue:edit')){ %>
							<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> ${text('保 存')}</button>&nbsp;
						<% } %>
						<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> ${text('关 闭')}</button>
					</div>
				</div>
			</div>
		</#form:form>
	</div>
</div>
<% } %>
<script>
$("#inputForm").validate({
	submitHandler: function(form){
		js.ajaxSubmitForm($(form), function(data){
			js.showMessage(data.message);
			if(data.result == Global.TRUE){
				js.closeCurrentTabPage(function(contentWindow){
					contentWindow.$('#dataGrid').dataGrid('refreshTreeChildren',
							$('#parentCode').val(), '${texaminationBarbecue.id}');
				});
			}
		}, "json");
    }
});
var objType = ${isNotBlank(texaminationBarbecue.objType!) ? texaminationBarbecue.objType! : "{\}"};
if(objType==3){
	   $("#courseContent3").removeClass("hide");
	}else if(objType==4){
		$("#courseContent4").removeClass("hide");
	}else if(objType==5){
		$("#courseContent4").removeClass("hide");
	}
function selectVal(e){
	var vale=$(e).val();
	$("#courseContent3").addClass("hide");
	$("#courseContent4").addClass("hide");
	if(vale==3){
	   $("#courseContent3").removeClass("hide");
	}else if(vale==4){
		$("#courseContent4").removeClass("hide");
	}else if(vale==5){
		$("#courseContent4").removeClass("hide");
	}
}
// 选择上级节点回调方法
function treeselectCallback(id, act, index, layero){
	if (id == 'parent' && (act == 'ok' || act == 'clear')){
		// 创建并初始化下一个节点信息，如：排序号、默认值
		$.get('${ctx}/zx/examination/barbecue/texaminationBarbecue/createNextNode?parentCode='
				+$('#parentCode').val(), function(data){
			$('#treeSort').val(data.treeSort);
		});
	}
}
</script>